package cn.tedu.di;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Student {
    private String name="jack";

    //DI是把相关的对象信息，自动装配--相当于底层加了get/set
    @Autowired//与Teacher类相关联，不需要再去另外get/set
    private Teacher teacher;
//    public Teacher getTeacher(){return teacher;}
//    public void setTeacher(Teacher teacher) { this.teacher = teacher; }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", teacher=" + teacher +
                '}';
    }
}
